package com.mohan.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.mohan.common.valid.AddGroup;
import com.mohan.common.valid.ListValue;
import com.mohan.common.valid.UpdateGroup;
import com.mohan.common.valid.UpdateStateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 *
 * @author mohan
 * @email 1358665425@qq.com
 * @date 2021-12-10 22:07:08
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
  private static final long serialVersionUID = 1L;

  /**
   * 品牌id
   */
  @TableId
  @NotNull(message = "修改的时候必须传入商标的id",groups = {UpdateGroup.class,UpdateStateGroup.class})
  @Null(message = "新增的时候必须为Null",groups = {AddGroup.class})
  private Long brandId;
  /**
   * 品牌名
   */
  @NotBlank(message = "品牌名必须提交!",groups = {AddGroup.class,UpdateGroup.class})
  private String name;
  /**
   * 品牌logo地址
   */
  @URL(message = "url必须是一个合法的校验规则",groups = {AddGroup.class,UpdateGroup.class})
  @NotNull(groups = {AddGroup.class})
  private String logo;
  /**
   * 介绍
   */
  private String descript;
  /**
   * 显示状态[0-不显示；1-显示]
   */
  @ListValue(vals = {0,1},groups = {AddGroup.class,UpdateGroup.class, UpdateStateGroup.class})
  private Integer showStatus;
  /**
   * 检索首字母
   */
  @NotNull(groups = {AddGroup.class})
  @Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须是一个字母",groups = {UpdateGroup.class,AddGroup.class})
  private String firstLetter;
  /**
   * 排序
   */
  @NotNull(groups = {AddGroup.class})
  @Min(value = 0,message = "至少应该是一个大于0的数字",groups = {UpdateGroup.class,AddGroup.class})
  private Integer sort;

}
